import request from '@/utils/request';
/**
 * 站点列表增加
 * @param params 查询条件
 */

export async function siteServiceInsert(data) {
  const res = await request.post('/api/TechnicianEnd/package-list/save', data);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 分页查询套餐列表
 * @param params 查询条件
 */

export async function siteServiceList(params) {
  const res = await request.get('/api/TechnicianEnd/package-list/page', {
    params
  });
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
/**
 * 站点列表修改
 * @param params 查询条件
 */
export async function siteServiceModify(data) {
  const res = await request.put('/api/TechnicianEnd/package-list/update', data);
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
export async function siteServiceModifyMultiple(data) {
  const res = await request.put('/api/TechnicianEnd/package-list/batch', data);
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
/**
 * 根据id查询套餐列表
 * @param params 查询条件
 */

export async function siteServiceDetail(id) {
  const res = await request.get('/api/TechnicianEnd/package-list/' + id);

  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 删除套餐列表
 * @param params 查询条件
 */

export async function sitecServiceDelete(id) {
  const res = await request.delete('/api/TechnicianEnd/package-list/' + id);
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 批量删除服务类目
 * @param params 查询条件
 */

export async function siteBatchServiceDelete(data) {
  const res = await request.delete('/api/TechnicianEnd/package-list/batch', {
    data
  });
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
